import { http } from "@/utils/http";

// 1、获取题目分类列表
export const getQuestionCategoryListAPI = data => {
  return http.request("post", "/dms/api/v1/exam/listQuestionCategory", {
    data
  });
};

// 2、保存题目分类
export const saveQuestionCategoryListAPI = data => {
  return http.request("post", "/dms/api/v1/exam/updateQuestionCategory", {
    data
  });
};

// 3、查看题目分类
export const viewQuestionCategoryAPI = data => {
  return http.request("post", "/dms/api/v1/exam/viewQuestionCategory", {
    data
  });
};

// 4、删除题目分类
export const deleteQuestionCategoryListAPI = data => {
  return http.request("post", "/dms/api/v1/exam/delQuestionCategory", {
    data
  });
};

// 5、获取题目列表
export const getQuestionListAPI = data => {
  return http.request("post", "/dms/api/v1/exam/listQuestionPage", {
    data
  });
};

// 6、删除题目
export const deleteQuestionAPI = data => {
  return http.request("post", "/dms/api/v1/exam/delQuestion", {
    data
  });
};

// 7、保存题目
export const saveQuestionAPI = data => {
  return http.request("post", "/dms/api/v1/exam/updateQuestion", {
    data
  });
};

// 8、查看题目
export const viewQuestionAPI = data => {
  return http.request("post", "/dms/api/v1/exam/viewQuestionOption", {
    data
  });
};

// 9、获取考试列表
export const getExamListAPI = data => {
  return http.request("post", "/dms/api/v1/exam/listExamPage", {
    data
  });
};

// 10、删除考试
export const deleteExamAPI = data => {
  return http.request("post", "/dms/api/v1/exam/delExam", {
    data
  });
};

// 11、发布考试
export const publishExamAPI = data => {
  return http.request("post", "/dms/api/v1/exam/publishExam", {
    data
  });
};

// 12、下架考试
export const unPublishExamAPI = data => {
  return http.request("post", "/dms/api/v1/exam/withdrawExam", {
    data
  });
};

// 13、保存考试配置
export const saveExamAPI = data => {
  return http.request("post", "/dms/api/v1/exam/updateExamExamineeQuestion", {
    data
  });
};

// 14、查询考试配置
export const getExamConfigAPI = data => {
  return http.request("post", "/dms/api/v1/exam/viewExamExamineeQuestion", {
    data
  });
};

// 15、自动组卷获取题目
export const getQuestionFromAutoGroupAPI = data => {
  return http.request("post", "/dms/api/v1/exam/assembleExamQuestion", {
    data
  });
};

// 16、我的考试
export const getMyExamListAPI = data => {
  return http.request("post", "/dms/api/v1/exam/listMyExamPage", {
    data
  });
};

// 17、考试台账
export const getExamLedgerListAPI = data => {
  return http.request("post", "/dms/api/v1/exam/listExamLedgePage", {
    data
  });
};

// 18、查询题目
export const getSubjectDetailAPI = data => {
  return http.request("post", "/dms/api/v1/exam/viewQuestionOption", {
    data
  });
};

// 19、获取考试结果
export const getExamResultDetailAPI = data => {
  return http.request("post", "/dms/api/v1/exam/detailMyTranscript", {
    data
  });
};

// 20、加载试卷
export const getExamAPI = data => {
  return http.request("post", "/dms/api/v1/exam/detailMyExam", {
    data
  });
};

// 21、提交考试
export const submitExamAPI = data => {
  return http.request("post", "/dms/api/v1/exam/submitMyExam", {
    data
  });
};

// 22、获取考试台账总览
export const getExamLedgerOverviewAPI = data => {
  return http.request("post", "/dms/api/v1/exam/viewExamSummary", {
    data
  });
};

// 23、获取考试台账明细
export const getExamLedgerDetailAPI = data => {
  return http.request("post", "/dms/api/v1/exam/listTranscriptLedgePage", {
    data
  });
};

// 24、考试题库上传
export const uploadAPI = data => {
  return http.request(
    "post",
    `/dms/api/v1/exam/uploadQuestion`,
    {
      data
    },
    {
      headers: {
        noLoading: true,
        "content-type": "application/x-www-form-urlencoded"
      }
    }
  );
};

// 25 重置考生的考试次数、清空考试记录
export const resetExamTimesAPI = data => {
  return http.request("post", "/dms/api/v1/exam/resetExamTimes", { data });
};

// 考试单独管理考生
export const saveExamineeAPI = data => {
  return http.request("post", "/dms/api/v1/exam/saveExaminee", {
    data
  });
};
